package DataStructureAndAlgorithm.AcWing_每日一题.枚举;
import java.util.Scanner;
//链接：https://www.acwing.com/problem/content/3805/：
public class AcWing_3802 {
    static int N = 32;
    static int[] nums = new int[N];
    public static void main(String[] args){
        //法一：爆搜，以每个点为中点进行爆搜即可
        //法二：区间dp
        Scanner in = new Scanner(System.in);
        int t = in.nextInt();
        for (int k = 0; k < t; k++){
            int n = in.nextInt();
            for (int i = 0; i < n; i++)nums[i] = in.nextInt();
            int res = dfs(0,n - 1);
            System.out.println(res);
        }
        in.close();
    }

    static int dfs(int left,int right){
        boolean flag = true;

        for (int i = left; i < right; i++){
            if (nums[i] > nums[i + 1]){
                //非递增
                flag = false;
            }
        }
        //如果是不是非递增，则放回长度
        if (flag)return right - left + 1;
        int mid = left + right >> 1;
        return Math.max(dfs(left,mid),dfs(mid + 1,right));
    }
}
